UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X+SpKYGAUxxKYsSMol4yqKbUtNWUyP5tAsNGF7z/n9g='
WHERE
key_id = 'a5000f0620e8479b09981931fc8345fa1e8606688f20cbc80aded49ce68af5f8'
AND (
token = 'X+SpKYGAUxxKYsSMol4yqKbUtNWUyP5tAsNGF7z/n9g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)