UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JnDfBWsiRIGEhAvCNLzgg0H868g85soIV+2DWGA39dU='
WHERE
key_id = '3e646e4c3140a05845bdbbc9fbfdf2dd7c71f737b7a84e20c29ddc14568703dd'
AND (
token = 'JnDfBWsiRIGEhAvCNLzgg0H868g85soIV+2DWGA39dU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)