UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rCff1o/icEpBrb5RjOjxpXcmsj7DpDaEmw8y8zTTEXw='
WHERE
key_id = 'b50491d996d0ed12d7b64a6e27f9b7e47e518d7f324c1631c439f7c0119a989b'
AND (
token = 'rCff1o/icEpBrb5RjOjxpXcmsj7DpDaEmw8y8zTTEXw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)