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