UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KXKhlSve/nSzVgPw2vBtZOW8MqgQ98AFmmTdn5PRfqo='
WHERE
key_id = 'e237f91b16feb99e1622f90b1eaa60caf4cb847f47ccc647c9f247b68ddef685'
AND (
token = 'KXKhlSve/nSzVgPw2vBtZOW8MqgQ98AFmmTdn5PRfqo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)