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