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