UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rYw+zgMERCEyVmbzw7TC10G5floD+qS2EIy1GAJ/6kM=' 
WHERE 
  key_id = 'c399d1650219d38788825e020ad26cac1126faa4e9735ec10fd6a0d384176dc5' 
  AND (
    token = 'rYw+zgMERCEyVmbzw7TC10G5floD+qS2EIy1GAJ/6kM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056