UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D9lXlRhNSOm6xavUcQTSdHMebE3teUJ8FJu2x5C8Kmg='
WHERE
key_id = 'ad36ad60b9c11c17526ca6d51a839c8577d99ca6b0bcf7d81a2a0823605e29cb'
AND (
token = 'D9lXlRhNSOm6xavUcQTSdHMebE3teUJ8FJu2x5C8Kmg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)