UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k2BD1cg1iNsGiWddBk+9/cCWf+jWwMhwZMEHMmmVyLs='
WHERE
key_id = 'e79fdecbc19776238499b6ce4732471cf3fd0b977fa360faae61dfb4cdec0bce'
AND (
token = 'k2BD1cg1iNsGiWddBk+9/cCWf+jWwMhwZMEHMmmVyLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)