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