UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'veuOj8KtnmXLMLgtiJYSIy0OaoIrhNG4jBzZj7v5T1g='
WHERE
key_id = '8e1abaaf09d17e436719f70e9c72f32172881287d92249d613b3ba2f5bac9630'
AND (
token = 'veuOj8KtnmXLMLgtiJYSIy0OaoIrhNG4jBzZj7v5T1g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)