UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H+68v7UAVQlE7fHSNbNCu6gmRoc0b4f7tjoadwSlmmQ=' 
WHERE 
  key_id = '16ebc655907e5d20fe3365e3e87f6f416cbfbc6542fc24b82a898435f9741328' 
  AND (
    token = 'H+68v7UAVQlE7fHSNbNCu6gmRoc0b4f7tjoadwSlmmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036