UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hYaIWhYq5OOMUErGwGdTV5vawAorImZ633FSnwiIgAI=' 
WHERE 
  key_id = '7508553cffa15033188c014d038d5cacbb909591c34403132cb356ab3bdd12ae' 
  AND (
    token = 'hYaIWhYq5OOMUErGwGdTV5vawAorImZ633FSnwiIgAI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041