UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T56Q97RyfeNtX3348KTFVzDMWEQAEvwUHhC8yFp4Zog='
WHERE
key_id = '2cc2bbb8bccac8994dc43cf15139f5cfd2fd5e4d616d941d071cedf783a9f75c'
AND (
token = 'T56Q97RyfeNtX3348KTFVzDMWEQAEvwUHhC8yFp4Zog='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)