UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oPgWfDZfyw0uHTdyQ2KqGpK8llzSLw7d903finLJQOk=' 
WHERE 
  key_id = '11b1617e1536c96fddbf7e6aef67ce7f5b06ebb87cbf789826ba794d15e3143a' 
  AND (
    token = 'oPgWfDZfyw0uHTdyQ2KqGpK8llzSLw7d903finLJQOk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026