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