UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3RAmQjY1nRCa1pr6Kp5xUq3PXQazBzGGzCeNIMXzvpI='
WHERE
key_id = 'c17059848d4502459f209429775395450b2ce28a9c6b312f631c5845bb361184'
AND (
token = '3RAmQjY1nRCa1pr6Kp5xUq3PXQazBzGGzCeNIMXzvpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)