UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GViRhWmtocdtWdmD4oohYoAr8aXG9lJxtujPKlb8DAo='
WHERE
key_id = 'ed0b77ac10a58f5856f9a0faad0e629a93e9df22f8572c974166d88e7d224593'
AND (
token = 'GViRhWmtocdtWdmD4oohYoAr8aXG9lJxtujPKlb8DAo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)