UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j+gcmdQOH9EqBvNjtzS2yq2LztoM6JbR+1xTnJwchaA=' 
WHERE 
  key_id = '6602cd03d73c739e19f752bdfbbd40db3949bfa777be480ced67b6aeacc884a6' 
  AND (
    token = 'j+gcmdQOH9EqBvNjtzS2yq2LztoM6JbR+1xTnJwchaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039