UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Be2SG+EP3A4RZL2EK8WEKbrimgDv/bPqV5UGqfZFuqA='
WHERE
key_id = '8c23d2401417be4d358854f8481fd828a95ac2cc0676ea0c13708c50e26f7d39'
AND (
token = 'Be2SG+EP3A4RZL2EK8WEKbrimgDv/bPqV5UGqfZFuqA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)