UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cpbi/gxKHiZXYZCNEfz9fk4kZtbHqXVbjUai8YqRLp4='
WHERE
key_id = '2351ad3eb11549c52cc45dcdb022b3acdae5797e988b5f4c428a7003f0e5793b'
AND (
token = 'Cpbi/gxKHiZXYZCNEfz9fk4kZtbHqXVbjUai8YqRLp4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)