UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tz9Ny/tDzt0Cyx0A8hcieChGfsLIVLMBxMfBDyNSkfg='
WHERE
key_id = 'f17a8e58e468b305766755f324b22142f3df1690fb47658d510468282f06c20e'
AND (
token = 'Tz9Ny/tDzt0Cyx0A8hcieChGfsLIVLMBxMfBDyNSkfg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)