UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rR9NNUMeNg6BEEAX/6TicGTFFnZavb6lIOV+kkmau6s='
WHERE
key_id = 'c097c34938253efe1713db85107b8764100e2af887415fcbf1e25a81d5f37787'
AND (
token = 'rR9NNUMeNg6BEEAX/6TicGTFFnZavb6lIOV+kkmau6s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)