UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bNQqLAWuTtg7nCK6jmD0CFQwUnjnofKmO/bNdVbjjuk='
WHERE
key_id = 'b81cdbf4c530017feb283330e7c23d7d7d95b88419dbc772ca810ccc66866110'
AND (
token = 'bNQqLAWuTtg7nCK6jmD0CFQwUnjnofKmO/bNdVbjjuk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)