UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1QPs5/aZ2Jsaj9AjAMGUwLxONfGy8zbGJHWSgp3bkmQ=' 
WHERE 
  key_id = '4e9b5f7ef86aa54c96a60c99ef77b2758315f206ba12fdb188103749dd233700' 
  AND (
    token = '1QPs5/aZ2Jsaj9AjAMGUwLxONfGy8zbGJHWSgp3bkmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029