UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tz7SurKHmfFp4ONW+u+WHWAr8MferaZQzCK/wQ4PDfc='
WHERE
key_id = 'f1f1e8e829b6ee7fac764863c1849923f10a42dbe78836896b26a79d0501c53f'
AND (
token = 'tz7SurKHmfFp4ONW+u+WHWAr8MferaZQzCK/wQ4PDfc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)