UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RMcrWXDeRe7bKPxM1Rq6EmURUO5cuFJNKxYUtztYzmg=' 
WHERE 
  key_id = '98d9799ea8cdbec264991c52b47b1c3dedf3c57b09cc17aa395ada90262b8261' 
  AND (
    token = 'RMcrWXDeRe7bKPxM1Rq6EmURUO5cuFJNKxYUtztYzmg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027