UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ooVBGX1/fFZdMK4OKiMztDkZdPhPV9z3f6tCyx8MX24='
WHERE
key_id = 'd2b1f1c0b4204b44f5af4439f7245cda5c4bd5effa52f9aa1d3d21a52e026f4e'
AND (
token = 'ooVBGX1/fFZdMK4OKiMztDkZdPhPV9z3f6tCyx8MX24='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)