UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '46AgqTu7nv+vpp3s5huDka9EkCSDOa6LCN0Ea7L0ZtM='
WHERE
key_id = '621f142354bba2d37ac42c48b370f0e09255615899b9f0c085369ca4fededfb7'
AND (
token = '46AgqTu7nv+vpp3s5huDka9EkCSDOa6LCN0Ea7L0ZtM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)