UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'teh9B3IViAt6FzzEdraBp+FeV0b4+wRZVvfSWs2h4QM='
WHERE
key_id = 'ddeb83a25515cb1e66ace657c92fc163bce16baffcc3aba963a3fef54433a3bd'
AND (
token = 'teh9B3IViAt6FzzEdraBp+FeV0b4+wRZVvfSWs2h4QM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)