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