UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XZ+uXitGEdByHVkOW/mdbImH+zMkqqPyWU33q9r3siU='
WHERE
key_id = 'b946879ab4ea1bc7f2d82b4f7d111f330540eb19b091b9afc7b0f5fb12ea8f0f'
AND (
token = 'XZ+uXitGEdByHVkOW/mdbImH+zMkqqPyWU33q9r3siU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)