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