UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Vt12FrM68UwHvJDfoRghPaLUXa5YuvETtPPW8g0xjLc='
WHERE
key_id = '737c22f9bef26badedd418d6c01ca6a8097a37e18bcd80a25b9929345d9cc502'
AND (
token = 'Vt12FrM68UwHvJDfoRghPaLUXa5YuvETtPPW8g0xjLc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)