UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+UxkMNB3mTI6h6o0JvualJmjT8jmNuVN5btgRT9tGCs=' 
WHERE 
  key_id = '97b07b6f315ad12f45fbd41876fe73cd1ccc911ff121e7cb540dbddd70061faa' 
  AND (
    token = '+UxkMNB3mTI6h6o0JvualJmjT8jmNuVN5btgRT9tGCs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029