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