UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Pr2wn6006NmKTx5+iP1ITdpDUyca3U1dcePg9xZty9w='
WHERE
key_id = 'cde8f63ca6bc8b9b2cdd954b0e3000daa77a6b0917c9d69616750a8913df0cd4'
AND (
token = 'Pr2wn6006NmKTx5+iP1ITdpDUyca3U1dcePg9xZty9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)